package configs

import (
	"log"

	"github.com/timest/env"
)

var Cron *cronConfig = new(cronConfig)

type cronConfig struct {
	ReadySpec  string `env:"CRON_READY_SPEC" default:"1/30 * * * * *" `
	FinishSpec string `env:"CRON_FINISH_SPEC" default:"1/40 * * * * *" `
	ClearSpec  string `env:"CRON_CLEAR_SPEC" default:"* 10 4 * * *" `
}

func InitCron() {
	Cron = new(cronConfig)
	env.IgnorePrefix()
	err := env.Fill(Cron)
	log.Printf("[INFO] Cron config :%+v\n", Cron)
	if err != nil {
		panic(err)
	}
}
